﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Joyintech.Common;
using Joyintech.Model.inpiao365;
using Joyintech.BLL.inpiao365;

namespace Joyintech.Web.inpiao365.Note_comment
{
    public partial class ajax_updown : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            { 
                //顶一下
                string CommentId = DNTRequest.GetQueryString("ID");

                if (CommentId != "" && PageValidate.IsNumber(CommentId))
                {
                    movieComment model = new movieComment();

                    movieComment_BLL movieCommentBLL = new movieComment_BLL();

                    model = movieCommentBLL.GetModel(Convert.ToInt32(CommentId));

                    if (model != null)
                    {
                        if (DNTRequest.GetQueryString("flage") == "0")
                        {
                            model.DingCount += 1;

                            movieCommentBLL.Update(model);

                            Response.Write(model.DingCount);
                        }
                        else
                        {
                            model.RabbitCount += 1;

                            movieCommentBLL.Update(model);

                            Response.Write(model.RabbitCount);
                        }
                    }
                    else
                    {
                        Response.Write("1");
                    }
                }
            }
        }
    }
}